import CryptoJS from 'crypto-js';

export const getTimestamp = (): string => {
  return Math.floor(Date.now() / 1000).toString();
};

export const generateSign = (timestamp: string, secretKey: string): string => {
  const method = 'GET';
  const requestPath = '/users/self/verify';
  const message = `${timestamp}${method}${requestPath}`;
  const hmac = CryptoJS.HmacSHA256(message, secretKey);
  return CryptoJS.enc.Base64.stringify(hmac);
};